package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface UserMapper {
    @Select("select * from user")
     List<User> selectAll();

    /**
     * 查询
     * @param openid
     * @return
     */
    @Select("select * from user where openid=#{openid}")
    User select(String openid);

    /**
     * 插入
     * @param use
     * @return
     */
    Integer insert(User use);

    /**
     * ton通过id获得信息
     * @param userId
     * @return
     */
    @Select("select * from user where id = #{userId}")
    User getById(Long userId);

    /**
     * 查询所有的用户数量
     * @param map
     * @return
     */
    String selectAllUser(Map<String, Object> map);

    /**
     * 查询今天新增用户
     * @param map
     * @return
     */
    String selectNewUser(Map<String, Object> map);
}
